package com.hs.srm.admin.modules.orders.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hs.srm.base.common.annotation.DictMapping;
import com.hs.srm.base.common.base.CloneableEntity;
import com.hs.srm.base.common.utils.DictDataUtil.DictType;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 采购订单行项目
 */
@Setter
@Getter
@TableName("scm_po_item")
@ToString
public class ScmPoItemEntity implements Serializable, CloneableEntity<ScmPoItemEntity> {

    private static final long serialVersionUID = 1L;

    public ScmPoItemEntity() {
        super();
    }

    /*
     * 行项目ID
     */
    @TableId(value = "po_item_id", type = IdType.UUID)
    @TableField("po_item_id")
    @Excel(name = "行项目ID", orderNum = "1")
    private java.lang.String poItemId;

    /*
     * 行项目号
     */
    @TableField("item_no")
    @Excel(name = "行项目号", orderNum = "2")
    private java.lang.String itemNo;

    /*
     * 项目类别
     */
    @TableField("project_category")
    @Excel(name = "项目类别", orderNum = "3")
    private java.lang.String projectCategory;

    /*
     * 科目分配类别
     */
    @TableField("subject_category")
    @Excel(name = "科目分配类别", orderNum = "4")
    private java.lang.String subjectCategory;

    /*
     * 物料编码
     */
    @TableField("material_code")
    @Excel(name = "物料编码", orderNum = "5")
    private java.lang.String materialCode;

    /*
     * 物料描述
     */
    @TableField("material_desc")
    @Excel(name = "物料描述", orderNum = "6")
    private java.lang.String materialDesc;

    /*
     * 工厂
     */
    @TableField("factory")
    @Excel(name = "工厂", orderNum = "7")
    @DictMapping(type = DictType.GC)
    private java.lang.String factory;

    /*
     * 库存地点
     */
    @TableField("storage_location")
    @Excel(name = "库存地点", orderNum = "8")
    @DictMapping(type = DictType.KCDD)
    private java.lang.String storageLocation;

    /*
     * 物料组
     */
    @TableField("material_group")
    @Excel(name = "物料组", orderNum = "9")
    @DictMapping(type = DictType.WLZ)
    private java.lang.String materialGroup;

    /*
     * 采购信息记录的编号
     */
    @TableField("purch_info_record_code")
    @Excel(name = "采购信息记录的编号", orderNum = "10")
    private java.lang.String purchInfoRecordCode;

    /*
     * 需求者/请求者姓名
     */
    @TableField("requester")
    @Excel(name = "需求者/请求者姓名", orderNum = "11")
    private java.lang.String requester;

    /*
     * 采购订单数量
     */
    @TableField("po_count")
    @Excel(name = "采购订单数量", orderNum = "12")
    private java.math.BigDecimal poCount;

    /*
     * 采购订单的计量单位
     */
    @TableField("po_unit")
    @Excel(name = "采购订单的计量单位", orderNum = "13")
    @DictMapping(type = DictType.JLDW)
    private java.lang.String poUnit;

    /*
     * 含税单价
     */
    @TableField("po_price")
    @Excel(name = "含税单价", orderNum = "14")
    private java.math.BigDecimal poPrice;

    /*
     * 价格单位
     */
    @TableField("price_unit")
    @Excel(name = "价格单位", orderNum = "15")
    private java.lang.String priceUnit;

    /*
     * 订单价格单位(采购)
     */
    @TableField("po_price_unit")
    @Excel(name = "订单价格单位(采购)", orderNum = "16")
    private java.lang.String poPriceUnit;

    /*
     * 税码
     */
    @TableField("tax_code")
    @Excel(name = "税码", orderNum = "19")
    @DictMapping(type = DictType.SDM)
    private java.lang.String taxCode;

    /*
     * 以采购订单货币计的订单总价值
     */
    @TableField("total_price")
    @Excel(name = "以采购订单货币计的订单总价值", orderNum = "20")
    private java.math.BigDecimal totalPrice;

    /*
     * 发票收据标识
     */
    @TableField("receive_flag")
    @Excel(name = "发票收据标识", orderNum = "21")
    private java.lang.String receiveFlag;

    /*
     * 标识：基于收货的发票验证
     */
    @TableField("invoice_flag")
    @Excel(name = "标识：基于收货的发票验证", orderNum = "22")
    private java.lang.String invoiceFlag;

    /*
     * 重要的采购协议号
     */
    @TableField("agreement_no")
    @Excel(name = "重要的采购协议号", orderNum = "23")
    private java.lang.String agreementNo;

    /*
     * 主要采购协议的项目编号
     */
    @TableField("agreement_item_no")
    @Excel(name = "主要采购协议的项目编号", orderNum = "24")
    private java.lang.String agreementItemNo;

    /*
     * 采购申请编号
     */
    @TableField("pr_no")
    @Excel(name = "采购申请编号", orderNum = "25")
    private java.lang.String prNo;

    /*
     * 采购申请的项目编号
     */
    @TableField("pr_item_no")
    @Excel(name = "采购申请的项目编号", orderNum = "26")
    private java.lang.String prItemNo;

    /*
     * 退货项目
     */
    @TableField("return_project")
    @Excel(name = "退货项目", orderNum = "27")
    private java.lang.String returnProject;

    /*
     * 标识：相关项目免费
     */
    @TableField("free_flag")
    @Excel(name = "标识：相关项目免费", orderNum = "28")
    private java.lang.String freeFlag;

    /*
     * 交货日期
     */
    @TableField("delivery_date")
    @Excel(name = "交货日期", orderNum = "29")
    @JSONField(format = "yyyy-MM-dd")
    //@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private java.util.Date deliveryDate;

    /*
     * 供应商回复交期
     */
    @TableField("reply_date")
    @Excel(name = "供应商回复交期", orderNum = "30")
    @JSONField(format = "yyyy-MM-dd")
    //@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private java.util.Date replyDate;

    /*
     * 成本中心
     */
    @TableField("cost_center")
    @Excel(name = "成本中心", orderNum = "31")
    @DictMapping(type = DictType.CBZX)
    private java.lang.String costCenter;

    /*
     * 固定资产号
     */
    @TableField("fixed_assets_no")
    @Excel(name = "固定资产号", orderNum = "31")
    private java.lang.String fixedAssetsNo;

    /*
     * 固定资产次级号
     */
    @TableField("fixed_assets_subno")
    @Excel(name = "固定资产次级号", orderNum = "32")
    private java.lang.String fixedAssetsSubno;

    /*
     * 订单号
     */
    @TableField("po_no")
    @Excel(name = "订单号", orderNum = "33")
    private java.lang.String poNo;

    /*
     * 内部订单号
     */
    @TableField("internal_po_no")
    @Excel(name = "内部订单号", orderNum = "34")
    private java.lang.String internalPoNo;

    /*
     * 备注
     */
    @TableField("remark")
    @Excel(name = "备注", orderNum = "35")
    private java.lang.String remark;

    /*
     * 附件
     */
    @TableField("attachment")
    @Excel(name = "附件", orderNum = "36")
    private java.lang.String attachment;

    /*
     * 行项目UUID
     */
    @TableField("item_uuid")
    @Excel(name = "行项目UUID", orderNum = "37")
    private java.lang.String itemUuid;

    /**
     * 行项目状态
     * 0草稿,1已经确认，-1取消,2分批发货,3订单发货完毕,4 已同步SAP
     */
    @TableField("item_status")
    @Excel(name = "行项目状态", orderNum = "38")
    private java.lang.String itemStatus;

    /**
     * 是否已收货
     */
    @TableField("receipted_flag")
    @Excel(name = "是否已收货", orderNum = "39")
    private java.lang.String receiptedFlag;

    /*
     * 删除标志
     */
    @TableField("delete_flag")
    @Excel(name = "删除标志", orderNum = "40")
    @DictMapping(type = DictType.SCZT)
    private java.lang.String deleteFlag;

    /*
     * 创建人
     */
    @TableField("created_by")
    @Excel(name = "创建人", orderNum = "51")
    private java.lang.String createdBy;


    /*
     * 创建日期
     */
    @TableField("creation_date")
    @Excel(name = "创建日期", orderNum = "52")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private java.sql.Timestamp creationDate;

    /*
     * 修改人
     */
    @TableField("last_updated_by")
    @Excel(name = "修改人", orderNum = "53")
    private java.lang.String lastUpdatedBy;

    /*
     * 修改日期
     */
    @TableField("last_update_date")
    @Excel(name = "修改日期", orderNum = "54")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private java.sql.Timestamp lastUpdateDate;

    /*
     * 建议交期
     */
    @TableField("suggest_date")
    @Excel(name = "建议交期", orderNum = "55")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private java.util.Date suggestDate;

    /*
     * 二维码地址
     */
    @TableField("url")
    @Excel(name = "图片地址", orderNum = "56")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private String url;

    /**
     * 待发货数量
     */
    @TableField("back_orders")
    @Excel(name = "待发货数量", orderNum = "45")
    private java.math.BigDecimal backOrders;
    /**
     * Sap订单号
     */
    @TableField(exist = false)
    //@Excel(name = "Sap订单号", orderNum = "57")
    private java.lang.String SapPoNo;

    /**
     * 是否为免费的
     */
    @TableField("free")
    private Integer free;

    /*
     * 内部订单号
     */
    @TableField("info_code")
    @Excel(name = "信息记录编码", orderNum = "58")
    private java.lang.String infoCode;

    /**
     * 是否来自配额，true/false
     */
    @TableField("from_quota_flag")
    @Excel(name = "是否来自配额", orderNum = "59")
    private java.lang.String fromQuotaFlag;

    /**
     * 送货单
     */
    @TableField("deliver_file")
    private Integer deliverFile;

    /**
     * 出货检测报告
     */
    @TableField("test_file")
    private Integer testFile;

    /**
     * 交货过量限度
     */
    @TableField("limit_full")
    private String limitFull;

    /**
     * 交货不足限度
     */
    @TableField("limit_less")
    private String limitLess;

    /**
     * 送货地址，0000023050工业厂；0000023052福仕厂；0000054814平巷
     */
    @TableField("delivery_address")
    @DictMapping(type = DictType.SAPSHDZ)
    private String deliveryAddress;
    /**
     * 供应商编码
     */
    @TableField(exist = false)
    private String vendorCode;

    /*
     *供应商姓名
     */
    @TableField(exist = false)
    private String vendorName;

    /*
     *货币码
     */
    @TableField(exist = false)
    private String currencyCode;


    /*
     * 试用次数
     *
     */
    @TableField("reason")
    @Excel(name = "试用次数", orderNum = "1")
    private int reason;

    /*
     * 规格
     */
    @TableField("specification")
    @Excel(name = "规格", orderNum = "5")
    private String specification;


    public ScmPoItemEntity(String poItemId, Integer testFile) {
        this.poItemId = poItemId;
        this.testFile = testFile;
    }

    @Override
    public ScmPoItemEntity clone() {
        try {
            return (ScmPoItemEntity) super.clone();
        } catch (CloneNotSupportedException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}
